<template>
    <div class="back">
        <div class="sen">
            <div class='num'>恭喜您答对了{{result.num}}题</div>
            <div class='score'>获得了{{result.score}}分</div>
        </div>
        <div class="butt">
            <router-link to="/detail">
                <el-button id='details'>
                    查看详情
                </el-button>
            </router-link>
        </div>
    </div>
</template>

<script>
    import axios from 'axios'
    export default {
        data() {
            return {
                result: ''
                // score: '',
                // num: '', //回答正确的题目数

            };
        },
        created: function () {
            this.init()
        },
        methods: {
            init() {
                // let name = sessionStorage.getItem('user_name')
                this.result = JSON.parse(sessionStorage.getItem('result'))
                console.log(this.result);
                // axios.get('http://localhost:3000/users').then((data) => {
                //     this.result = data.data[name]
                //     // console.log('user_ans: ');
                //     console.log(this.result);
                // }).catch(err => {
                //     console.error(err);
                // })
            }
        }
    }
</script>

<style>
    .back {
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
        height: 100vh;
        background-image: url(./../assets/恭喜答对.jpg);
        background-size: 100% 100%;
    }

    .back .sen {
        /* position: absolute;
        top: 40vh;
        left: 20vw; */
        margin: 0 50%;
        margin-top: 59%;
        background-color: rgb(254, 113, 125);
        color: rgb(254, 244, 193);
        width: 420px;
        height: 200px;
    }

    .butt #details {
        /* margin: 50% 0%;
        margin-top: 65%; */
        border-radius: 70px;
        position: absolute;
        top: 70vh;
        left: 20vw;
        background-color: rgb(247, 97, 108);
        width: 440px;
        height: 125px;
    }
</style>